{{include template('public/header','admin')}}
<style>
    #category_template{
        width: 300px;
    }
    #list_template{
        width: 300px;
    }
    #show_template{
        width: 300px;
    }
</style>
<body>
    <div id="page-wrapper">
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <fieldset>
                    <legend>{{$action}}{{$title}}</legend>
                    <form action="{{url($postUrl)}}" method="post" class="form-horizontal validform" id="cpform" name="cpform" role="form" autocomplete='off' >
                        <input type='hidden' name='catid' value="{{$item['catid']}}" />
                        <input type='hidden' name='type' value="{{$item['type']}}" />
                        <input type='hidden' name='arrparentid' value="{{$item['arrparentid']}}" />
                        <input type='hidden' name='arrchildid' value="{{$item['arrchildid']}}" />
                        <ul id="myTab" class="nav nav-tabs">
                            <li class="active"><a href="#home" data-toggle="tab">基本选项</a></li>
                            {{if $item.type ne '2' }}
                            <li><a href="#template" data-toggle="tab">模板设置</a></li>
                            {{/if}}
                            <li><a href="#seo" data-toggle="tab">SEO设置</a></li>
                        </ul>
                        <div id="myTabContent" class="tab-content">
                            <div class="tab-pane fade in active" id="home">
                                <br/>
                                {{if $item.type eq '0' || $item.type eq '2' }}
                                <div class="form-group">
                                    <label for="modelid" class="col-sm-2 control-label"><span class="red">*</span>{{L('category_modelid')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        {{showsitemodel($item["modelid"],'modelid')}}
                                    </div>
                                </div>
                                {{/if}}
                                <div class="form-group">
                                    <label for="parentid" class="col-sm-2 control-label">{{L('category_parentid')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        {{select_category('parentid', $item['parentid'], '', 0, '', false, false)}}
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label for="catname" class="col-sm-2 control-label"><span class="red">*</span>{{L('category_catname')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <input type="text" id="catname" name='catname' value="{{$item.catname}}" maxlength="255" tabindex="3" class='form-control' onblur="tickycms_pinyin()"
                                               datatype="*" nullmsg="{{L('category_catname')}}不能为空" errormsg="{{L('category_catname')}}不能为空"  placeholder="请输入{{L('category_catname')}}"    />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="catdir" class="col-sm-2 control-label"><span class="red">*</span>{{L('category_catdir')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <input type="text" id="catdir" name='catdir' value="{{$item.catdir}}" maxlength="255" tabindex="3" class='form-control'
                                               datatype="*" nullmsg="{{L('category_catdir')}}不能为空" errormsg="{{L('category_catdir')}}不能为空"  placeholder="请输入{{L('category_catdir')}}" />
                                    </div>
                                </div>
                                {{if $item.type eq '2'}}
                                <div class="form-group">
                                    <label for="pclink" class="col-sm-2 control-label">{{L('category_pclink')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <input type="text" id="pclink" name='pclink' value="{{$item.pclink}}" maxlength="255" tabindex="3" class='form-control' style="width: 500px;" />
                                    </div>
                                </div>
                                {{else}}
                                <input type='hidden' name='pclink' value="{{$item['pclink']}}" />
                                {{/if}}
                                <div class="form-group">
                                    <label for="catimg" class="col-sm-2 control-label">{{L('category_catimg')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <input type="text" id="catimg" name='catimg' value="{{$item.catimg}}" maxlength="255" tabindex="7" class='form-control' style="width: 500px;"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="member_publish" class="col-sm-2 control-label">{{L('category_member_publish')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <label class="radio-inline">
                                            <input type="radio" name="member_publish" id="member_publish1" value="1" {{if $item.member_publish eq '1'}}checked{{/if}} >是
                                        </label>
                                        <label class="radio-inline">
                                            <input type="radio" name="member_publish" id="member_publish2" value="0" {{if $item.member_publish eq '0'}}checked{{/if}} >否
                                        </label>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="display" class="col-sm-2 control-label">{{L('category_disabled')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <label class="radio-inline">
                                            <input type="radio" name="disabled" id="display1" value="1" {{if $item.disabled eq '1'}}checked{{/if}} >是
                                        </label>
                                        <label class="radio-inline">
                                            <input type="radio" name="disabled" id="display2" value="0" {{if $item.disabled eq '0'}}checked{{/if}} >否
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane fade" id="template" >
                                <br/>
                                <div class="form-group">
                                    <label for="category_template" class="col-sm-2 control-label" {{if $item.type eq '2' }}style="display:none;" {{/if}}>
                                           {{if $item.type eq '1' }}单页模板{{else}} <span class="red">*</span>{{L('category_category_template')}}{{/if}}
                                    </label>
                                    {{form::select_template('category_temp', 'category_','id="category_template"  name="category_template"  datatype="*"',$item.category_template)}}
                                </div>
                                <div class="form-group" {{if $item.type eq '1' or $item.type eq '2' }}style="display:none;" {{/if}}>
                                     <label for="list_template" class="col-sm-2 control-label"><span class="red">*</span>{{L('category_list_template')}}</label>
                                    {{form::select_template('list_temp', 'list_','id="list_template" name="list_template"  datatype="*"',$item.list_template)}}

                                </div>
                                <div class="form-group" {{if $item.type eq '1' or $item.type eq '2' }}style="display:none;" {{/if}}>
                                     <label for="show_template" class="col-sm-2 control-label"><span class="red">*</span>{{L('category_show_template')}}</label>
                                    {{form::select_template('show_temp', 'show_','id="show_template" name="show_template"  datatype="*"',$item.show_template)}}
                                </div>
                            </div>
                            <div class="tab-pane fade" id="seo">
                                <br/>
                                <div class="form-group">
                                    <label for="seo_title" class="col-sm-2 control-label"><span class="red">*</span>{{L('category_seo_title')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <input type="text" id="seo_title" name='seo_title' value="{{$item.seo_title}}" maxlength="255" tabindex="7" class='form-control'
                                               datatype="*" nullmsg="SEO{{L('category_seo_title')}}不能为空" errormsg="SEO{{L('category_seo_title')}}不能为空"  placeholder="请输入{{L('category_seo_title')}}"       />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="seo_keywords" class="col-sm-2 control-label"><span class="red">*</span>{{L('category_seo_keywords')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <input type="text" id="seo_keywords" name='seo_keywords' value="{{$item.seo_keywords}}" maxlength="255" tabindex="7" class='form-control'
                                               datatype="*" nullmsg="SEO{{L('category_seo_keywords')}}不能为空" errormsg="SEO{{L('category_seo_keywords')}}不能为空"  placeholder="请输入{{L('category_seo_keywords')}}"       />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="seo_description" class="col-sm-2 control-label"><span class="red">*</span>{{L('category_seo_description')}}</label>
                                    <div class="col-sm-10 form-inline">
                                        <textarea  id="seo_description" name='seo_description' class="form-control"  rows="3" maxlength="255" tabindex="7" style="margin: 0px; height: 172px; width: 471px;"
                                                   datatype="*" nullmsg="SEO{{L('category_seo_description')}}不能为空" errormsg="SEO{{L('category_seo_description')}}不能为空" placeholder="请输入{{L('category_seo_description')}}" >{{$item.seo_description}}</textarea>

                                    </div>
                                </div>
                            </div>
                        </div>
                        <script>
                            $(function () {
                                $('#myTab li:eq(0) a').tab('show');
                            });
                        </script>

                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <input type='submit' name='dosubmit' class='btn btn-primary' value='{{L('submit')}}' />
                                <a href="/admin/category" class="btn btn-default radius">{{L('cancel')}}</a>
                            </div>
                        </div>
                    </form>
                </fieldset>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="{{STATIC_URL}}/plugins/pinyin.js"></script>

    <script type="text/javascript">
                            function tickycms_pinyin() {
                                var pinyin = codefans_net_CC2PY($("input[name='catname']").val());
                                $("input[name='catdir']").val(pinyin.toLowerCase());
                            }
    </script>
    <script type="text/javascript">
        $(function () {
            $(".validform").Validform({
                tiptype: 1, showAllError: false,
                beforeSubmit: function (curform) {
                    //在验证成功后，表单提交前执行的函数，curform参数是当前表单对象。
                    //这里明确return false的话表单将不会提交;
                    if ($("select[name='catid']").val() == '0') {
                        $.Showmsg("请选择栏目！");
                        return false;
                    }
                    if (UM.getEditor('content').getContent() == '') {
                        $.Showmsg("内容不能为空！");
                        return false;
                    }
                    return true;
                }
            });
        });
    </script>
</body>
</html>



